package com.yqyd.web.controller.nbot.web;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.yqyd.nbot.domain.NbotMenu;
import com.yqyd.nbot.service.INbotMenuService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yqyd.common.annotation.Log;
import com.yqyd.common.core.controller.BaseController;
import com.yqyd.common.core.domain.AjaxResult;
import com.yqyd.common.enums.BusinessType;
import com.yqyd.common.core.page.TableDataInfo;

/**
 * 九号-功能菜单Controller
 * 
 * @author Dhq
 * @date 2025-08-15
 */
@RestController
@RequestMapping("/nbot/menu")
public class NbotMenuController extends BaseController
{
    @Autowired
    private INbotMenuService nbotMenuService;
    /**
     * 查询九号-功能菜单列表
     */
    @PreAuthorize("@ss.hasPermi('nbot:menu:list')")
    @GetMapping("/list")
    public TableDataInfo list(NbotMenu nbotMenu)
    {
        startPage();
        List<NbotMenu> list = nbotMenuService.selectNbotMenuList(nbotMenu);
        return getDataTable(list);
    }

    /**
     * 获取九号-功能菜单详细信息
     */
    @PreAuthorize("@ss.hasPermi('nbot:menu:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(nbotMenuService.selectNbotMenuById(id));
    }

    /**
     * 新增九号-功能菜单
     */
    @PreAuthorize("@ss.hasPermi('nbot:menu:add')")
    @Log(title = "九号-功能菜单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody NbotMenu nbotMenu)
    {
        return toAjax(nbotMenuService.insertNbotMenu(nbotMenu));
    }

    /**
     * 修改九号-功能菜单
     */
    @PreAuthorize("@ss.hasPermi('nbot:menu:edit')")
    @Log(title = "九号-功能菜单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody NbotMenu nbotMenu)
    {
        return toAjax(nbotMenuService.updateNbotMenu(nbotMenu));
    }

    /**
     * 删除九号-功能菜单
     */
    @PreAuthorize("@ss.hasPermi('nbot:menu:remove')")
    @Log(title = "九号-功能菜单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(nbotMenuService.deleteNbotMenuByIds(ids));
    }
}
